## 重写LoginRequiredMixin中的get_login_url方法 重新修改登录路径
from django.contrib.auth.mixins import  LoginRequiredMixin
from django.utils.encoding import force_text
from django.core.exceptions import ImproperlyConfigured
from django.core.urlresolvers import reverse


class MyLoginRequiredMixin(LoginRequiredMixin):
    def get_login_url(self):
        """
        Override this method to override the login_url attribute.
        """
        login_url = reverse('login')
        if not login_url:
            raise ImproperlyConfigured(
                '{0} is missing the login_url attribute. Define {0}.login_url'
                '{0}.get_login_url().'.format(self.__class__.__name__)
            )
        return force_text(login_url)




